package dao;

import vo.Inventory;
import vo.Send;

import java.util.List;

public class SendDaoimpl extends BaseDao implements ISend{

    @Override
    public boolean add(Send send) {
        String sql="insert into send values(?,?,?);";
        return update(sql,send.getInventory_id(),send.getCount(),send.getContract_id());
    }

    @Override
    public boolean delete(Send send) {//通过商品的id来找到要删除的信息
        String sql="delete from send where inventory_id=?";
        return update(sql,send.getInventory_id());
    }

    @Override
    public boolean modify(Send send) { //传入修改后的发货表来替换原来的,通过商品id来查找
        String sql="update send set inventory_id=?,count=?,contract_id=? where inventory_id=?";
        return update(sql,send.getInventory_id(),send.getCount(),send.getContract_id(),send.getInventory_id());
    }

    @Override
    public Send getcustombyid(int id) { //按照商品的id来查询
        String sql="select*from send where inventory_id=?";
        return  getInstance(Send.class,sql,id);//按照商品编号查询
    }

    @Override
    public List<Send> getall() {
        String sql="select*from inventory";
        return getList(Send.class,sql);//查询到的所有信息
    }
}
